home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Systemmonitors / AskTask / asktask.doc < prev    next >
Text File  |  1996-09-26  |  9KB  |  162 lines

  1.                          AskTask Documentation                               
  2.  
  3.     USAGE: asktask [<-opt>]
  4.         where opt = c    - use my default colors (the intended ones for
  5.                            this program). The previous colors are restored
  6.                            when asktask is terminated.
  7.                     p{n} - start with priority n. Asktask sets its own
  8.                            priority to a default of 15. This option will
  9.                            replace 15 with n. Note that the CLI launching
  10.                            asktask will get this priority too, and retains
  11.                            it even after asktask has terminated. I tend to
  12.                            use 'run asktask -p0'.
  13.         NOTE: [] = optional, <> = 1 or more, {} = mandatory.
  14.  
  15.     DISCLAIMER: this program accesses important system data structures. It
  16.     should never be used along with programs containing important, unsaved
  17.     data, execpt in emergencies.
  18.  
  19.     PURPOSE:
  20.         Asktask is intended to allow the user to examine various bits of
  21.     the task structures of all the tasks in the system (except itself).
  22.     These are accessed from the 'ready' and 'waiting' lists attached to
  23.     ExecBase. The information displayed is:
  24.             priority    (task->tc_Node.ln_Pri)
  25.             state       (task->tc_State)
  26.             flags       (task->tc_Flags)
  27.             stack       (task->tc_SPReg, tc_SPLower, tc_SPUpper)
  28.                     Rg = register pointer.
  29.                     Up = upper address + 2.
  30.                     Lw = lower address.
  31.                     Sz = Size.
  32.                     Rm = Remaining space.
  33.                 (Note: if Rg doesn't lie between Up and Lw, then the task
  34.                  is no doubt a CLI process, where the Rg address is the
  35.                  command's stack pointer, not the CLI's.)
  36.             signals     (tc_SigAlloc, tc_SigWait, tc_SigRecvd, tc_Except)
  37.                     A = allocated signals.
  38.                     W = waiting signals.
  39.                     R = recieved signals.
  40.                     E = exception signals accepted.
  41.     Some facilities for altering this data are also provided, but for the
  42.     purpose of experimenting only!.
  43.  
  44.     OPERATION NOTES:
  45.         -) You can select a task by clicking on its name.
  46.         -) Asktask's internal task pointer array is not updated unless
  47.            you use the refresh operation.
  48.         -) Be aware that the CLI asktask is launched from gets asktask's
  49.            priority of 15. So any other programs launched from that CLI
  50.            will inherit this unusually large priority, perhaps interfering
  51.            with asktask itself.
  52.         -) A task may be paused by allocating a signal, and setting the
  53.            corresponding wait signal bit, clearing the others. Starting it
  54.            again is a problem though!
  55.         -) RemTask() may be used to remove the current task. This unloads
  56.            the task. This should not be used to kill tasks that are CLI
  57.            commands, since the CLI is removed as well. (A CLI command
  58.            doesn't seem to be a seperate task from its CLI; ie: the CLI
  59.            does not fork off a new task to run commands, unless you use
  60.            'run' (or use WShell or some other shells background task option)
  61.            to start the command).
  62.         -) Exit() may be used to remove the current task. A context switch
  63.            results in the task's pc address being stored on its stack.
  64.            Asktask redirects this address to a piece of data within asktask
  65.            that results in the task calling the DOS function Exit(). This
  66.            should only be used to terminate CLI tasks that are currently
  67.            running a command.
  68.         -) The ABORT (CTRL-C) signal can be sent to the current task by
  69.            setting the appropriate tc_SigRecvd bit (bit # 12 counting from
  70.            zero). This is the preferred method for zapping CLI tasks, but
  71.            only works if the task recognizes the signal. This is
  72.            accomplished for Lattice C users during chkabort(), or level 2(?)
  73.            IO routines. I recommend using the chkabort() and onbreak()
  74.            functions.
  75.         -) WARNING: try not to kill a task that owns some essential system
  76.            resource, particularly the blitter. The removal may well happen
  77.            before the task frees the resource, in which case deadlock city.
  78.            Try reducing its priority instead.
  79.         -) WARNING: try not to kill a task that waits for many messages from
  80.            somebody else. For example, killing the clock program causes a
  81.            'Finish all disk activity - Task held' type requester to appear.
  82.            While other programs will be unaffected, the CLI used to run
  83.            the held task will be frozen.
  84.         -) Note that asktask deals with tasks. Not processes. For those
  85.            who don't know, a process is a task that has been launched by
  86.            AmigaDOS (the CLI or Workbench), and hence has a process data
  87.            structure associated with it as well as a task structure. Asktask
  88.            does not care about this process structure, since tasks are the
  89.            lowest level of multitasking, and while all processes have tasks,
  90.            not all tasks have processes. A similar program could be written
  91.            to get at processes through the DOSBase pointer.
  92.         -) If you set a task's priority (using asktask) to something
  93.            greater than asktask's, asktask will boost its own priority to
  94.            the task's new priority plus 5. Hence the maximum priority you
  95.            can set is 122 (127 - 5). This can be useful if some task has a
  96.            priority that interferes with the system tasks. For instance,
  97.            if you start test from the same CLI as asktask, and it thus
  98.            inherits a priority of 15, because test does no waiting it will
  99.            lock out the trackdisk.device and FileSystem tasks. In addition,
  100.            it will not appear on asktask's task list. Why not I don't know,
  101.            but it needs to have its priority reduced. To do this, you need
  102.            to increase asktask's priority to something greater than 15. So
  103.            selecting say the input.device, and changing its priority to 21
  104.            will boost asktask's priority to 26, thus allowing you to control
  105.            test with asktask. Because asktask spends most of its time
  106.            waiting for your input, it is safe to set asktask's priority as
  107.            high as you like.
  108.         -) Questions can be sent to me at:
  109.                             J.Bickers,
  110.                             214 Rata St,
  111.                             Naenae.
  112.            Complaints can jump in the nearest lake.
  113.  
  114.                 o/          o__
  115.                 |          /          __o            _
  116.                 >          >         >  \             \
  117.              ­­­­       ­­­­      ­­­­          ­­­­   \o¸
  118.                                                       »»\««    
  119.  
  120.     EXAMPLE:
  121.         1) run asktask.
  122.         2) make PopCLI III the current task by clicking on it.
  123.         3) select the SIGNAL operation, then press r for the Recvd signal
  124.            bits. Set the 3 bits to the right of the leftmost two, and press
  125.            return.
  126.         4) a newcli should appear (you have simulated the PopCLI hotkey).
  127.         5) start the 'test' program from the newcli. This program is an
  128.            infinite loop:
  129.                     while (1) j++;
  130.         6) refresh the task list a few times to get the newcli task on the
  131.            list, then select it as the current task.
  132.         7) select the Exit() operation, and press y.
  133.         8) the newcli prompt should reappear, test having been forced to
  134.            terminate.
  135.         NOTE: for some reason, endcli doesn't close down the new CLI
  136.            console. Presumably because test has some files still open, such
  137.            as its stdout, which is of course, the console!
  138.  
  139.     DISTRIBUTION:
  140.         -) this program can be distributed freely, or for a maximum cost of
  141.            copying + postage.
  142.         -) this program cannot be ported to other, ridiculous, single-task
  143.            machines, so there's no problem with that.
  144.         -) feel free to alter or copy the code as you wish.
  145.  
  146.     SOURCE: The following files make up the source code -
  147.                     asktask.h           at_input.c
  148.                     asktask.c           at_kill.c
  149.                     at_gadg.c           at_putdata.c
  150.                     at_help.c           trans.c
  151.             blink with asktask.lnk
  152.  
  153.             The following files are also included:
  154.                     asktask.doc
  155.                     test.c/test
  156.  
  157.     IMPORTANT NOTE: Discovered the task structure is actually contained
  158.         WITHIN (at the start of) a process structure if that task is also
  159.         a process. That is how Exit() knows which process... A pointer to
  160.         a task structure is also a pointer to its process structure:
  161.                         see libraries/dosextens
  162.